<?php
namespace Weixin\Controller;

class MenuController extends BaseController{
       //创建自定义菜单
        public function create(){
            $access_token = $this->getaccess_token();
            $url ="https://api.weixin.qq.com/cgi-bin/menu/create?access_token=$access_token";

            $fields =<<<php
            {
         "button":[
         {    
              "type":"click",
              "name":"今日歌曲",
              "key":"V1001_TODAY_MUSIC"
          },
          {
               "name":"菜单",
               "sub_button":[
               {    
                   "type":"view",
                   "name":"搜索",
                   "url":"http://www.baidu.com/"
                },
    
                {
                   "type":"click",
                   "name":"赞一下我们",
                   "key":"V1001_GOOD"
                }]
           },
            {
                "name":"图片",
                       "sub_button":[
                       {
                           "type":"pic_sysphoto",
                           "name":"相机",
                           "key":"V1002_GOOD",
                           "sub_button":[ ]
    
                        },
    
                        {
                            "type":"pic_weixin",
                            "name":"相册",
                            "key":"V1003_GOOD",
                            "sub_button":[ ]
    
                        }]
             }
           ]
        }
php;
    $res = $this->curl($url,$fields);
    print_r($res);die;
 }
        
}